-- 20220916
ALTER TABLE `md_item` ADD COLUMN `mes_type` varchar(255) NULL COMMENT 'mes 配置的类型' AFTER `measure_no`;

ALTER TABLE `md_item` ADD COLUMN `mes_type_name` varchar(1000) NULL COMMENT 'mes 配置的类型' AFTER `mes_type`;

ALTER TABLE `mes_scales_order_item` ADD COLUMN `viscosity` varchar(255) NULL COMMENT '粘度' AFTER `product_spc`;

ALTER TABLE `mes_scales_order_item` ADD COLUMN `packing_type` varchar(255) NULL COMMENT '包装规格' AFTER `viscosity`;

ALTER TABLE `pro_workorder` ADD COLUMN `viscosity` varchar(255) NULL COMMENT '粘度' AFTER `product_spc`;

ALTER TABLE `pro_workorder` ADD COLUMN `packing_type` varchar(255) NULL COMMENT '包装规格' AFTER `viscosity`;


-- 更新菜单

ALTER TABLE md_client
    ADD COLUMN `pubufts` integer(11) ZEROFILL NOT NULL COMMENT '更新标识' AFTER `update_time`;

--


-- 22-10-13 更新菜单权限
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2312, '生产工序内容列表', 2109, 7, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:processcontent:list', '#', 'admin', '2022-10-13 15:41:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2313, '导出生产工序内容列表', 2109, 8, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:processcontent:export', '#', 'admin', '2022-10-13 15:47:40', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2314, '获取生产工序内容详细信息', 2109, 9, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:processcontent:query', '#', 'admin', '2022-10-13 15:48:36', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2315, '新增生产工序内容', 2109, 10, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:processcontent:add', '#', 'admin', '2022-10-13 15:49:12', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2316, '修改生产工序内容', 2109, 11, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:processcontent:edit', '#', 'admin', '2022-10-13 15:51:34', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2317, '删除生产工序内容', 2109, 12, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:processcontent:remove', '#', 'admin', '2022-10-13 15:51:50', '', NULL, '');


-- 2022-10-18 生成排产添加字段
ALTER TABLE pro_task add month varchar(30) COMMENT '排产日期';
ALTER TABLE pro_task add production_date datetime COMMENT '排产日期';
ALTER TABLE pro_task add time_slot varchar(50) COMMENT '时间段(上午，下午，通宵)';

-- 2022-10-18 物料入库单行表 添加物料状态字段
ALTER TABLE wm_item_recpt_line add let_step_material int COMMENT '物料状态(普通,让步物料)';


-- 2022-10-18 入库日期
ALTER TABLE wm_transaction  ADD COLUMN `recpt_date` datetime NULL COMMENT '入库日期' AFTER `vendor_nick`;

-- 2022-10-18  入库单物料权限
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3000, '入库单物料信息', 2042, 17, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:list', '#', 'admin', '2022-10-13 15:41:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3101, '入库单物料列表', 3000, 0, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:list', '#', 'admin', '2022-10-13 15:41:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3102, '入库单物料报表', 3000, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:export', '#', 'admin', '2022-10-13 15:47:40', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3103, '入库单物料查询', 3000, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:query', '#', 'admin', '2022-10-13 15:48:36', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3104, '入库单物料添加', 3000, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:add', '#', 'admin', '2022-10-13 15:49:12', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3105, '入库单物料编辑', 3000, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:edit', '#', 'admin', '2022-10-13 15:51:34', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3106, '入库单物料删除', 3000, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:itemrecptline:remove', '#', 'admin', '2022-10-13 15:51:50', '', NULL, '');


-- 2022-10-18 添加菜单权限（班次管理）
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3108, '查询班次列表', 3114, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:shift:list', '#', 'admin', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3109, '导出计划班次列表', 3114, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:shift:export', '#', 'admin', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3110, '获取计划班次详细信息', 3114, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:shift:query', '#', 'admin', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3111, '新增计划班次', 3114, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:shift:add', '#', 'admin', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3112, '修改计划班次', 3114, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:shift:edit', '#', 'admin', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3113, '删除计划班次', 3114, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:shift:remove', '#', 'admin', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3114, '班次管理', 2168, 6, 'shift', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:cal:shift', '', 'MES', '2022-10-18 19:27:41', '', NULL, '');

-- 2022-10-18 添加菜单权限(班组管理)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3115, '班组管理', 2168, 7, 'planteam', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:cal:planteam', '', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3116, '查询计划班组列表', 3115, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:planteam:list', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3117, '导出计划班组列表', 3115, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:planteam:export', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3118, '获取计划班组详细信息', 3115, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:planteam:query', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3119, '新增计划班组', 3115, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:planteam:add', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3120, '修改计划班组', 3115, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:planteam:edit', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3121, '删除计划班组', 3115, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:cal:planteam:remove', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');

-- 2022-10-18 添加菜单权限(出货检验单行管理)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3122, '出货检验单行管理', 2306, 7, '', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:qc:oqcline', '', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3123, '查询出货检验单行列表', 3122, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqcline:list', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3124, '导出出货检验单行列表', 3122, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqcline:export', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3125, '获取出货检验单行详细信息', 3122, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqcline:query', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3126, '新增出货检验单行', 3122, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqcline:add', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3127, '修改出货检验单行', 3122, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqcline:edit', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3128, '删除出货检验单行', 3122, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:oqcline:remove', '#', 'MES', '2022-10-18 18:43:52', '', NULL, '');


-- 2022-10-19 添加菜单权限(检验单缺陷记录管理)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3129, '检验单缺陷记录管理', 2306, 7, 'efectrecord', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:qc:defectrecord', '#', 'admin', '2022-10-19 10:46:51', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3130, '查询检验单缺陷记录列表', 3129, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:defectrecord:list', '#', 'admin', '2022-10-19 10:47:04', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3131, '导出检验单缺陷记录列表', 3129, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:defectrecord:export', '#', 'admin', '2022-10-19 10:47:30', 'admin', '2022-10-19 10:48:27', '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3132, '获取检验单缺陷记录详细信息', 3129, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:defectrecord:query', '#', 'admin', '2022-10-19 10:47:45', 'admin', '2022-10-19 10:48:39', '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3133, '新增检验单缺陷记录', 3129, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:defectrecord:add', '#', 'admin', '2022-10-19 10:47:57', 'admin', '2022-10-19 10:48:49', '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3134, '修改来料检验单缺陷记录', 3129, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:defectrecord:edit', '#', 'admin', '2022-10-19 10:49:09', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3135, '删除检验单缺陷记录', 3129, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:defectrecord:remove', '#', 'admin', '2022-10-19 10:49:28', '', NULL, '');

-- 2022-10-19 添加菜单权限(过程检测详情查询)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3136, '过程检测详情查询', 2213, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:query', '#', 'admin', '2022-10-19 11:15:21', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3137, '过程检测修改', 2213, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:edit', '#', 'admin', '2022-10-19 11:19:37', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3138, '过程检测删除', 2213, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:remove', '#', 'admin', '2022-10-19 11:20:01', '', NULL, '');

-- 2022-10-19 添加菜单权限 (过程检验单行)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3139, '过程检验单行', 2213, 6, 'ipqcline', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:qc:ipqcline', '#', 'admin', '2022-10-19 11:34:29', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3140, '查询过程检验单行列表', 3139, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqcline:list', '#', 'admin', '2022-10-19 11:34:46', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3141, '导出过程检验单行列表', 3139, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqcline:export', '#', 'admin', '2022-10-19 11:35:04', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3142, '获取过程检验单行详细信息', 3139, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqcline:query', '#', 'admin', '2022-10-19 11:35:14', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3143, '新增过程检验单行', 3139, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqcline:add', '#', 'admin', '2022-10-19 11:35:28', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3144, '修改过程检验单行', 3139, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqcline:edit', '#', 'admin', '2022-10-19 11:35:40', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3145, '删除过程检验单行', 3139, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqcline:remove', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');

-- 2022-10-19 添加菜单权限(过程检测导出)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3159, '过程检测导出', 2213, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:ipqc:export', '#', 'admin', '2022-10-19 18:15:20', '', NULL, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('点检计划导出', 2191, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:export', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2192, '点检计划列表查询', 2191, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:list', '#', 'admin', '2022-06-16 21:36:03', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2193, '点检计划查看', 2191, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:query', '#', 'admin', '2022-06-16 21:36:34', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2196, '点检计划删除', 2191, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:remove', '#', 'admin', '2022-06-16 21:37:35', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2195, '点检计划编辑', 2191, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:edit', '#', 'admin', '2022-06-16 21:37:15', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2194, '点检计划新增', 2191, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:add', '#', 'admin', '2022-06-16 21:36:56', '', NULL, '');
INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3176, '点检计划导出', 2191, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checkplan:export', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');

INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('生产领料-物料信息添加', 2229, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueline:add', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('生产领料-物料信息列表', 2229, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueline:list', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('生产领料-物料信息编辑', 2229, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueline:edit', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('生产领料-物料信息删除', 2229, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueline:remove', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('生产领料-物料信息查询', 2229, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueline:query', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('生产报工查询', 2292, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:feedback:query', '#', 'admin', '2022-10-19 11:35:55', '', NULL, '');

alter table `md_client` alter column pubufts set default 0;

-- 2022-10-20 添加菜单权限(新增维修单)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3175, '新增维修单', 2301, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repair:add', '#', 'admin', '2022-10-20 12:02:58', '', NULL, '');

-- 2022-10-20 添加菜单权限 (维修单行)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3182, '设备维修单行', 2301, 6, 'repairline', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:dv:repairline', '#', 'admin', '2022-10-20 15:32:50', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3183, '查询设备维修单行列表', 3182, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repairline:list', '#', 'admin', '2022-10-20 15:33:01', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3184, '导出设备维修单行列表', 3182, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repairline:export', '#', 'admin', '2022-10-20 15:33:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3185, '获取设备维修单行详细信息', 3182, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repairline:query', '#', 'admin', '2022-10-20 15:33:34', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3186, '新增设备维修单行', 3182, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repairline:add', '#', 'admin', '2022-10-20 15:33:49', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3187, '修改设备维修单行', 3182, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repairline:edit', '#', 'admin', '2022-10-20 15:34:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3188, '删除设备维修单行', 3182, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:repairline:remove', '#', 'admin', '2022-10-20 15:34:21', '', NULL, '');

-- 2022-10-20 添加菜单权限 (工单BOM导出)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3189, '工单BOM导出', 2073, 10, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:workorderbom:export', '#', 'admin', '2022-10-20 15:48:24', '', NULL, '');

-- 2022-10-20 添加菜单权限 (检测模板-检测项)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3190, '检测模板-检测项', 2132, 6, 'templateindex', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:qc:templateindex', '#', 'admin', '2022-10-20 16:09:28', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3191, '查询检测模板-检测项列表', 3190, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateindex:list', '#', 'admin', '2022-10-20 16:09:47', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3192, '导出检测模板-检测项列表', 3190, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateindex:export', '#', 'admin', '2022-10-20 16:10:02', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3193, '获取检测模板-检测项详细信息', 3190, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateindex:query', '#', 'admin', '2022-10-20 16:10:15', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3194, '新增检测模板-检测项', 3190, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateindex:add', '#', 'admin', '2022-10-20 16:10:26', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3195, '修改检测模板-检测项', 3190, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateindex:edit', '#', 'admin', '2022-10-20 16:10:38', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3196, '删除检测模板-检测项', 3190, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateindex:remove', '#', 'admin', '2022-10-20 16:10:52', '', NULL, '');

-- 2022-10-20 添加菜单权限 (检测模板-产品)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3197, '检测模板-产品', 2132, 7, 'templateproduct', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:qc:templateproduct', '#', 'admin', '2022-10-20 16:12:19', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3198, '查询检测模板-产品列表', 3197, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateproduct:list', '#', 'admin', '2022-10-20 16:12:27', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3199, '导出检测模板-产品列表', 3197, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateproduct:export', '#', 'admin', '2022-10-20 16:12:40', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3200, '获取检测模板-产品详细信息', 3197, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateproduct:query', '#', 'admin', '2022-10-20 16:12:51', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3201, '新增检测模板-产品', 3197, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateproduct:add', '#', 'admin', '2022-10-20 16:13:03', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3202, '修改检测模板-产品', 3197, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateproduct:edit', '#', 'admin', '2022-10-20 16:13:15', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3203, '删除检测模板-产品', 3197, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:qc:templateproduct:remove', '#', 'admin', '2022-10-20 16:13:26', '', NULL, '');

-- 2022-10-20 添加菜单权限(生成报工详细信息)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3204, '生产报工详细信息', 2292, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:feedback:query', '#', 'admin', '2022-10-20 16:38:18', '', NULL, '');

-- 2022-10-20 添加菜单权限(供应商退货行)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3205, '供应商退货行', 2179, 6, 'rtvendorline', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:wm:rtvendorline', '#', 'admin', '2022-10-20 16:59:54', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3206, '查询供应商退货行列表', 3205, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendorline:list', '#', 'admin', '2022-10-20 17:00:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3207, '导出供应商退货行列表', 3205, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendorline:export', '#', 'admin', '2022-10-20 17:00:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3208, '获取供应商退货行详细信息', 3205, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendorline:query', '#', 'admin', '2022-10-20 17:00:27', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3209, '新增供应商退货行', 3205, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendorline:add', '#', 'admin', '2022-10-20 17:00:38', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3210, '修改供应商退货行', 3205, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendorline:edit', '#', 'admin', '2022-10-20 17:00:49', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3211, '删除供应商退货行', 3205, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:rtvendorline:remove', '#', 'admin', '2022-10-20 17:01:02', '', NULL, '');


-- 2022-10-20 添加菜单权限
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3212, '设备资源', 2088, 7, 'workstationmachine', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:md:workstationmachine', '#', 'admin', '2022-10-20 20:42:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3213, '查询设备资源列表', 3212, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationmachine:list', '#', 'admin', '2022-10-20 20:42:18', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3214, '导出设备资源列表', 3212, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationmachine:export', '#', 'admin', '2022-10-20 20:42:31', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3216, '获取设备资源详细信息', 3212, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationmachine:query', '#', 'admin', '2022-10-20 20:42:47', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3217, '新增设备资源', 3212, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationmachine:add', '#', 'admin', '2022-10-20 20:43:01', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3218, '修改设备资源', 3212, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationmachine:edit', '#', 'admin', '2022-10-20 20:43:13', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3219, '删除设备资源', 3212, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationmachine:remove', '#', 'admin', '2022-10-20 20:43:25', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3220, '工装夹具资源', 2088, 8, 'workstationtool', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:md:workstationtool', '#', 'admin', '2022-10-20 20:45:37', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3221, '查询工装夹具资源列表', 3220, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationtool:list', '#', 'admin', '2022-10-20 20:45:45', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3222, '导出工装夹具资源列表', 3220, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationtool:export', '#', 'admin', '2022-10-20 20:45:56', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3223, '获取工装夹具资源详细信息', 3220, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationtool:query', '#', 'admin', '2022-10-20 20:46:09', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3224, '新增工装夹具资源', 3220, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationtool:add', '#', 'admin', '2022-10-20 20:46:21', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3225, '修改工装夹具资源', 3220, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationtool:edit', '#', 'admin', '2022-10-20 20:46:33', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3226, '查询人力资源列表', 2088, 9, 'workstationworker', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:md:workstationworker', '#', 'admin', '2022-10-20 20:47:57', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3227, '查询人力资源列表', 3226, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationworker:list', '#', 'admin', '2022-10-20 20:48:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3228, '导出人力资源列表', 3226, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationworker:export', '#', 'admin', '2022-10-20 20:48:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3229, '获取人力资源详细信息', 3226, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationworker:query', '#', 'admin', '2022-10-20 20:48:30', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3230, '新增人力资源', 3226, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationworker:add', '#', 'admin', '2022-10-20 20:48:42', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3231, '修改人力资源', 3226, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationworker:edit', '#', 'admin', '2022-10-20 20:48:52', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3232, '删除人力资源', 3226, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:md:workstationworker:remove', '#', 'admin', '2022-10-20 20:49:04', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3233, '点检项目', 2191, 7, 'checksubject', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:dv:checksubject', '#', 'admin', '2022-10-20 20:52:00', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3234, '查询点检项目列表', 3233, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checksubject:list', '#', 'admin', '2022-10-20 20:52:08', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3235, '导出点检项目列表', 3233, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checksubject:export', '#', 'admin', '2022-10-20 20:52:21', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3236, '获取点检项目详细信息', 3233, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checksubject:query', '#', 'admin', '2022-10-20 20:52:30', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3237, '新增点检项目', 3233, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checksubject:add', '#', 'admin', '2022-10-20 20:52:41', 'admin', '2022-10-20 20:53:20', '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3238, '修改点检项目', 3233, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:dv:checksubject:edit', '#', 'admin', '2022-10-20 20:52:53', 'admin', '2022-10-20 20:53:25', '');

-- 2022-10-21 添加菜单权限(工艺流程)
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3247, '工艺组成', 2116, 7, 'routeprocess', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:pro:routeprocess', '#', 'admin', '2022-10-21 10:23:18', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3248, '查询工艺组成列表', 3247, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeprocess:list', '#', 'admin', '2022-10-21 10:23:28', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3249, '查询指定产品的工艺组成', 3247, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:list', '#', 'admin', '2022-10-21 10:23:42', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3250, '导出工艺组成列表', 3247, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeprocess:export', '#', 'admin', '2022-10-21 10:23:53', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3251, '获取工艺组成详细信息', 3247, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeprocess:query', '#', 'admin', '2022-10-21 10:24:05', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3252, '新增工艺组成', 3247, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeprocess:add', '#', 'admin', '2022-10-21 10:24:15', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3253, '修改工艺组成', 3247, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeprocess:edit', '#', 'admin', '2022-10-21 10:24:27', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3254, '删除工艺组成', 3247, 7, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeprocess:remove', '#', 'admin', '2022-10-21 10:33:41', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3255, '关联产品', 2116, 8, 'routeproduct', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:pro:routeproduct', '#', 'admin', '2022-10-21 10:41:22', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3256, '查询产品制程列表', 3255, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:list', '#', 'admin', '2022-10-21 10:41:35', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3257, '导出产品制程列表', 3255, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:export', '#', 'admin', '2022-10-21 10:41:46', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3258, '获取产品制程详细信息', 3255, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:query', '#', 'admin', '2022-10-21 10:41:55', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3259, '新增产品制程', 3255, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:add', '#', 'admin', '2022-10-21 10:42:04', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3260, '修改产品制程', 3255, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:edit', '#', 'admin', '2022-10-21 10:42:16', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3261, '删除产品制程', 3255, 7, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproduct:remove', '#', 'admin', '2022-10-21 10:43:42', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3262, '产品制程物料BOM', 2116, 9, 'routeproductbom', NULL, NULL, 1, 0, 'C', '0', '0', 'mes:pro:routeproductbom', '#', 'admin', '2022-10-21 10:47:26', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3263, '查询产品制程物料BOM列表', 3262, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproductbom:list', '#', 'admin', '2022-10-21 10:47:34', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3264, '导出产品制程物料BOM列表', 3262, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproductbom:export', '#', 'admin', '2022-10-21 10:47:51', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3265, '获取产品制程物料BOM详细信息', 3262, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproductbom:query', '#', 'admin', '2022-10-21 10:48:03', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3266, '新增产品制程物料BOM', 3262, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproductbom:add', '#', 'admin', '2022-10-21 10:48:14', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3267, '修改产品制程物料BOM', 3262, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproductbom:edit', '#', 'admin', '2022-10-21 10:48:24', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3268, '删除产品制程物料BOM', 3262, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:pro:routeproductbom:remove', '#', 'admin', '2022-10-21 10:48:34', '', NULL, '');

INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3269, '生产领料导出', 2229, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'mes:wm:issueheader:export', '#', 'MES', '2022-10-21 11:32:43', '', NULL, '');


-- 2022-10-24 工单
ALTER TABLE `pro_workorder`
    ADD COLUMN `batch_code` varchar(255) NULL COMMENT '批次号' AFTER `client_name`;
ALTER TABLE wm_material_stock  ADD COLUMN `workorder_id` bigint NULL COMMENT '生产工单ID' AFTER `quantity_onhand`;
ALTER TABLE wm_material_stock  ADD COLUMN `workorder_code` varchar(64) NULL COMMENT '生产工单编号' AFTER `workorder_id`;
ALTER TABLE wm_material_stock  ADD COLUMN `recpt_date` datetime NULL COMMENT '入库日期' AFTER `workorder_code`;

ALTER TABLE md_workstation  ADD COLUMN `warehouse_id` bigint NULL COMMENT '线边库ID' AFTER `process_name`;
ALTER TABLE md_workstation  ADD COLUMN `warehouse_code` varchar(64) NULL COMMENT '线边库编码' AFTER `warehouse_id`;
ALTER TABLE md_workstation  ADD COLUMN `warehouse_name` varchar(255) NULL COMMENT '线边库名称' AFTER `warehouse_code`;

ALTER TABLE pro_route_process  ADD COLUMN `key_flag` varchar(255) NULL COMMENT '关键工序' AFTER `color_code`;

ALTER TABLE md_workstation  ADD COLUMN `warehouse_code` varchar(64) NULL COMMENT '线边库编码' AFTER `warehouse_id`;

-- ---

ALTER TABLE md_workstation  ADD COLUMN `location_id` bigint NULL COMMENT '库区ID' AFTER `warehouse_name`;
ALTER TABLE md_workstation  ADD COLUMN `location_code` varchar(64) NULL COMMENT '库区编码' AFTER `location_id`;
ALTER TABLE md_workstation  ADD COLUMN `location_name` varchar(255) NULL COMMENT '库区名称' AFTER `location_code`;

ALTER TABLE md_workstation  ADD COLUMN `area_id` bigint NULL COMMENT '库位ID' AFTER `location_name`;
ALTER TABLE md_workstation  ADD COLUMN `area_code` varchar(64) NULL COMMENT '库位编码' AFTER `area_id`;
ALTER TABLE md_workstation  ADD COLUMN `area_name` varchar(255) NULL COMMENT '库位名称' AFTER `area_code`;



ALTER TABLE pro_feedback  ADD COLUMN feedback_type bigint COMMENT '报工类型' AFTER `record_id`;
ALTER TABLE pro_feedback  ADD COLUMN `item_id` bigint NULL COMMENT '产品物料ID' AFTER `task_code`;
ALTER TABLE pro_feedback  ADD COLUMN `item_code` varchar(64) NULL COMMENT '产品物料编码' AFTER `item_id`;
ALTER TABLE pro_feedback  ADD COLUMN `item_name` varchar(255) NULL COMMENT '产品物料名称' AFTER `item_code`;

ALTER TABLE pro_feedback  ADD COLUMN `unit_of_measure` varchar(64) NULL COMMENT '单位' AFTER `item_name`;
ALTER TABLE pro_feedback  ADD COLUMN `specification` varchar(512) NULL COMMENT '规格型号' AFTER `unit_of_measure`;

ALTER TABLE pro_feedback  ADD COLUMN `record_user` varchar(64) NULL COMMENT '单位' AFTER `feedback_time`;
ALTER TABLE pro_feedback  ADD COLUMN `record_nick` varchar(64) NULL COMMENT '状态' AFTER `record_user`;
ALTER TABLE pro_feedback  ADD COLUMN `status` varchar(64) NULL COMMENT '状态' AFTER `record_nick`;

-- 2022-10-24 在线打印设计菜单
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3270, '在线打印设计', 1, 1, 'http://localhost:8080/jmreport/list', NULL, NULL, 1, 0, 'C', '0', '0', NULL, 'monitor', 'admin', '2022-10-24 18:56:10', '', NULL, '');

-- 2022-10-26 添加工序模板字段
ALTER TABLE pro_route_process add is_testing int COMMENT '是否检测工序';
ALTER TABLE pro_route_process add template_id bigint COMMENT '检测模板id';
ALTER TABLE pro_route_process add template_name varchar(50) COMMENT '检测模板名称';

-- 2022-10-27 过程检验单行表 添加检测值字段 过程检验添加桶号字段
ALTER TABLE qc_ipqc_line add detection_value double(12, 4) COMMENT '检测值';
ALTER TABLE qc_ipqc add bucket VARCHAR(50) COMMENT '桶号';

-- 2022-10-27 物料产品添加字段
ALTER TABLE md_item add valid_term int COMMENT '有效期(月)';
ALTER TABLE md_item add net_weight varchar(50) COMMENT '净重';
ALTER TABLE md_item add identification varchar(50) COMMENT '标识';
ALTER TABLE md_item add ink_type varchar(50) COMMENT '油墨类型';
ALTER TABLE md_item add standard varchar(50) COMMENT '标准';

--2022-10-28 添加在线打印设计菜单
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3271, '在线打印设计', 1, 1, 'jimureport', 'system/jimureport/index', NULL, 1, 0, 'C', '0', '0', '', 'chart', 'admin', '2022-10-28 11:00:28', 'admin', '2022-10-28 16:38:20', '');

-- 2022-11-05 工序检测项表

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for rec_processes_ext
-- ----------------------------
DROP TABLE IF EXISTS `rec_processes_ext`;
CREATE TABLE `rec_processes_ext`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '工序项id',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'PDA字段名称',
  `des` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字段说明',
  `required` int NULL DEFAULT NULL COMMENT 'PDA是否必填字段（0-必填 1-不是必填）',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'PDA字段类型',
  `process_id` bigint NULL DEFAULT NULL COMMENT '工序id',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '工序项' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

-- 2022-11-05 检测记录表

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for rec_lnspection_record
-- ----------------------------
DROP TABLE IF EXISTS `rec_lnspection_record`;
CREATE TABLE `rec_lnspection_record`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录id',
  `tool_type_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '桶编号',
  `tool_type_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '桶名称',
  `processes_id` bigint NULL DEFAULT NULL COMMENT '工序id',
  `specification` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '型号',
  `task_id` bigint NULL DEFAULT NULL COMMENT '任务id',
  `task_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务名称',
  `workstation_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工作站编号',
  `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `dic_text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '字典',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '工序检测记录' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;




-- 2022-11-5 创建添加部门id字段
ALTER TABLE wm_warehouse add dept_id bigint COMMENT '部门id';


-- 2022-11-9 出货检验单行表 来料检验单行表 添加检测值字段  工序添加检测模板id字段
ALTER TABLE qc_oqc_line add detection_value double(12, 4) COMMENT '检测值';
ALTER TABLE qc_iqc_line add detection_value double(12, 4) COMMENT '检测值';
ALTER TABLE pro_process add template_id bigint COMMENT '检测模板id';

-- 2022-11-11 数据源数据库 添加备注字段
ALTER TABLE pro_process add remark varchar(255) COMMENT '备注';


ALTER TABLE pro_workorder add tag varchar(255) COMMENT '产品标签';

-- 2022-11-16 修改工序配置后台参数
ALTER TABLE rec_processes_ext add name_backstage varchar(255) COMMENT '后台参数名称';
ALTER TABLE rec_processes_ext add order_backstage INT COMMENT '后台排序';
ALTER TABLE rec_processes_ext add require_backstage INT COMMENT '后台是否必填';
ALTER TABLE rec_processes_ext add rule_backstage JSON COMMENT '配置参数：type:展示类型,len:长度,min:最小值，max:最大值,param:参数';
ALTER TABLE rec_processes_ext add rule_pda JSON COMMENT '配置参数：type:展示类型,len:长度,min:最小值，max:最大值,param:参数';


-- 2022-11-18 修改工序流程，工序配置参数
ALTER TABLE pro_route_process add param_json JSON COMMENT '配置参数：type:展示类型,len:长度,min:最小值，max:最大值,param:参数';
ALTER TABLE pro_route_process add group_num INT COMMENT '工序组';


-- 2022-11-16 工作站的线边库id 库区id  库位id   设备编码  默认可以为空
alter table md_workstation modify  warehouse_id bigint   null;
alter table md_workstation modify  location_id bigint  null;
alter table md_workstation modify  area_id bigint  null;
alter table dv_machinery modify  machinery_code varchar(64)  null;

ALTER TABLE md_workstation_machine add equipment_code varchar(64) COMMENT '设备号';
ALTER TABLE dv_machinery add capacity int COMMENT '产能';
ALTER TABLE dv_machinery add sort int COMMENT '排序';
ALTER TABLE dv_machinery add equipment_code varchar(64) COMMENT '设备号';

-- 2022-11-17
ALTER TABLE dv_machinery add product varchar(64) COMMENT '推荐生产产品';
ALTER TABLE dv_machinery add is_pro_equipment char COMMENT '是否生产设备';

alter table pro_task modify  workstation_id bigint  null;
alter table pro_task modify  workstation_code varchar(64)  null;
alter table pro_task modify  workstation_name varchar(255)  null;
alter table pro_task modify  process_id bigint  null;

-- 2022-11-19
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3295, '排产记录', 2072, 6, 'protask', 'mes/pro/task/index', NULL, 1, 0, 'C', '0', '0', 'mes:pro:task', 'clipboard', 'admin', '2022-11-18 11:54:02', 'MES', '2022-11-19 16:23:47', '');
alter table qc_template modify  qc_types varchar(255)  null;


-- 2022-11-21
ALTER TABLE rec_processes_ext ADD COLUMN `remark` text NULL COMMENT '备注';
ALTER TABLE `md_item` ADD COLUMN `process_product_name` varchar(255) NULL COMMENT '根据工序流程区分的产品名称';
ALTER TABLE `pro_route_product` ADD COLUMN `process_product_name` varchar(255) NULL COMMENT '根据工序流程区分的产品名称';

-- 2022-11-21 产品入库单行 物料状态默认为0
alter table wm_item_recpt_line alter column  let_step_material set default   0;

-- 2022-11-22 排产任务添加批次信息
ALTER TABLE pro_task add batch_no integer COMMENT '生产批次';
ALTER TABLE pro_task add viscosity varchar(255) COMMENT '粘度';
ALTER TABLE pro_task ADD COLUMN `process_product_name` varchar(255) NULL COMMENT '根据工序流程区分的产品名称';
ALTER TABLE `pro_task`
    MODIFY COLUMN `start_time` datetime NULL DEFAULT NULL COMMENT '开始生产时间' AFTER `time_slot`,
    MODIFY COLUMN `duration` int NULL DEFAULT NULL COMMENT '生产时长' AFTER `start_time`;

ALTER TABLE rec_lnspection_record add remark varchar(3000) COMMENT '备注';


ALTER TABLE rec_lnspection_record add remark varchar(3000) COMMENT '备注';


ALTER table rec_lnspection_record ADD INDEX idx_taskId (task_id);
ALTER table rec_lnspection_record ADD INDEX idx_processesId (processes_id);
SHOW INDEXES FROM rec_lnspection_record;

-- 创建生产关联表（排产任务，生产设备，工序）
-- Table structure for rec_processes_ext
-- ----------------------------
DROP TABLE IF EXISTS `pro_task_device_process`;
CREATE TABLE `pro_task_device_process`  (
                                      `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '工序项id',

                                      `task_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '任务id',
                                      `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '任务名称',

                                      `device_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '设备id',
                                      `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '设备名称',

                                      `route_process_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '工艺流程中工序项配置的ID',
                                      `process_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '工序项ID',
                                      `process_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '工序名称',

                                      `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
                                      `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                      `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
                                      `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                      `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',

                                      PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '创建生产关联表（排产任务，生产设备，工序）' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


-- 配置菜单，配置角色

ALTER TABLE pro_task_device_process add work_type varchar(255) not null COMMENT '当前工作类型，1正常 2返工';


-- ALTER TABLE rec_processes_ext ADD unique idx_process_id_name( process_id, name); -- PDA 名称不能重复
-- ALTER TABLE rec_processes_ext ADD unique idx_process_id_name_backstage( process_id, name_backstage); -- 后台参数名 名称不能重复

ALTER TABLE `pro_route_product` ADD unique idx_process_product_name (process_product_name);  -- 产品只能关联一个工艺流程

-- 收录生产警告警告
DROP TABLE IF EXISTS `pro_waring`;
CREATE TABLE `pro_waring`  (
                                      `id` bigint NOT NULL AUTO_INCREMENT COMMENT '警告记录id',
                                      `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
                                      `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                      `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
                                      `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                      `remark` varchar(3000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',

                                      `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '警告类型',
                                      `record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'PDA采集的记录ID',

                                      `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生产任务',
                                      `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生产批次',
                                      `device_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备编码',
                                      `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称',
                                      `process_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工序名称',
                                      `bucket` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装桶',
                                      `des` longText CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '警告说明',


                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '收录生产警告警告' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


ALTER TABLE rec_lnspection_record add batch_no varchar(255) not null COMMENT '生产批次';
ALTER TABLE rec_lnspection_record add processes_name varchar(255) not null COMMENT '工序名称';
ALTER TABLE pro_task add route_id bigint not null COMMENT '工艺路线ID';


-- 2022-11-29

ALTER TABLE pro_route_process ADD INDEX idx_route_id( route_id); -- 经常使用
SHOW INDEXES FROM pro_route_process;
SHOW INDEXES FROM rec_lnspection_record;



ALTER TABLE pro_task_device_process add batch_no bigint not null COMMENT '批次号';


-- 创建生产设备 上传的数据
-- Table structure for rec_processes_ext
-- ----------------------------
DROP TABLE IF EXISTS `dv_watt_hour_meter_data`;
CREATE TABLE `dv_watt_hour_meter_data`  (
                                         `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '工序项id',

                                         `task_device_process_record_id` bigint NOT NULL COMMENT '生产关联（排产任务，生产设备，工序）',
                                         `task_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '任务id',
                                         `device_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '设备id',
                                         `process_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '工序项ID',

                                         `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
                                         `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                         `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
                                         `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                         `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',

                                         `runtime` DOUBLE  NULL DEFAULT NULL COMMENT '运行时间',
                                         `va` DOUBLE  NULL DEFAULT NULL COMMENT '',
                                         `vb` DOUBLE NULL DEFAULT NULL COMMENT '',
                                         `vc` DOUBLE NULL DEFAULT NULL COMMENT '',
                                         `ia` DOUBLE NULL DEFAULT NULL COMMENT '',
                                         `ib` DOUBLE NULL DEFAULT NULL COMMENT '',
                                         `ic` DOUBLE NULL DEFAULT NULL COMMENT '',

                                         `ZXYGZDL` DOUBLE  NULL DEFAULT NULL COMMENT '度数',
                                         `ZSZGL` DOUBLE NULL DEFAULT NULL COMMENT '大于等于1代表启动中',
                                         `ZGLYS` DOUBLE  NULL DEFAULT NULL COMMENT '',
                                         `hz` DOUBLE NULL DEFAULT NULL COMMENT '',

                                         PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '电表 上传的数据' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


DROP TABLE IF EXISTS `dv_warm_humid_data`;
CREATE TABLE `dv_warm_humid_data`  (
                                    `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '工序项id',

                                    `task_device_process_record_id` bigint NOT NULL COMMENT '生产关联（排产任务，生产设备，工序）',
                                    `task_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '任务id',
                                    `device_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '设备id',
                                    `process_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '工序项ID',

                                    `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
                                    `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                    `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
                                    `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',

                                    `temp_sd` DOUBLE  NULL DEFAULT NULL COMMENT '湿度',
                                    `temp_wd` DOUBLE  NULL DEFAULT NULL COMMENT '温度',




                                    PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '温湿传感器 上传的数据' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;



DROP TABLE IF EXISTS `dv_temperature_data`;
CREATE TABLE `dv_temperature_data`  (
                                     `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '工序项id',

                                     `task_device_process_record_id` bigint NOT NULL COMMENT '生产关联（排产任务，生产设备，工序）',
                                     `task_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '任务id',
                                     `device_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '设备id',
                                     `process_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '工序项ID',

                                     `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
                                     `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                     `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改者',
                                     `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                     `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',

                                     `temp1` DOUBLE  NULL DEFAULT NULL COMMENT '温度',

                                     PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '温度传感器 上传的数据' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;



ALTER TABLE dv_machinery add watt_hour_meter varchar(255) COMMENT '电表';
ALTER TABLE dv_machinery add thermometer varchar(255) COMMENT '温度计';

ALTER TABLE pro_task_device_process add status varchar(64) COMMENT '状态';

-- 2022-11-30
ALTER TABLE rec_lnspection_record add task_device_process_record_id bigint NOT NULL COMMENT '生产关联（排产任务，生产设备，工序）';

ALTER TABLE pro_waring add machinery_data_id bigint NOT NULL COMMENT '设备上传数据的记录ID';


ALTER TABLE pro_task_device_process ADD INDEX idx_status(status); -- 经常使用

ALTER TABLE rec_lnspection_record add wen_du DOUBLE  COMMENT '温度';
ALTER TABLE rec_lnspection_record add shi_chang INTEGER  COMMENT '时长(秒)';
ALTER TABLE rec_lnspection_record add last_status DOUBLE  COMMENT '上衣状态';
ALTER TABLE rec_lnspection_record add last_index INTEGER  COMMENT '最后标志';
ALTER TABLE rec_lnspection_record add machinery_id bigint  COMMENT '最后标志';

ALTER TABLE pro_task_device_process add watt_hour_meter varchar(255) not null  COMMENT '电表';
ALTER TABLE pro_task_device_process add thermometer varchar(255) not null  COMMENT '温度计';
ALTER TABLE pro_task_device_process add warm_humid varchar(255) not null  COMMENT '温湿计';

ALTER TABLE pro_task_device_process add param_json JSON not null  COMMENT '工艺配置参数';
ALTER TABLE pro_task_device_process add batch_no varchar(255) not null  COMMENT '批次';

ALTER TABLE dv_machinery add warm_humid varchar(255)  COMMENT '温湿计';

-- 2022/12/1
ALTER TABLE rec_lnspection_record add work_type varchar(32) COMMENT '类型';


-- 权限
SELECT * FROM sys_menu WHERE create_time > '2022-11-01 15:37:18';
-- 字典
SELECT * FROM sys_dict_type WHERE create_time > '2022-11-01 15:37:18';
-- 字段内容
SELECT * FROM sys_dict_data WHERE create_time > '2022-11-01 15:37:18';

-- 2022-12-02
-- 统计订单库存
ALTER TABLE mes_scales_order_item add count_scheduling decimal  COMMENT '排产数量';
ALTER TABLE mes_scales_order_item add count_product decimal  COMMENT '生产数量';
ALTER TABLE mes_scales_order_item add count_complete decimal  COMMENT '完成数量';
ALTER TABLE mes_scales_order_item add count_surplus decimal  COMMENT '剩余数量';


ALTER TABLE pro_task_device_process add workorder_id bigint  COMMENT '生产订单ID';
ALTER TABLE pro_task_device_process add scale_id varchar(64)  COMMENT '销售订单Id';


ALTER TABLE pro_task add scale_id varchar(64)  COMMENT '销售订单Id';
ALTER TABLE pro_task add is_finish varchar(4)  COMMENT '是否完成';


ALTER TABLE rec_processes_ext ADD COLUMN `order_pda` integer COMMENT 'PDA排序';
ALTER TABLE `rec_processes_ext`
    CHANGE COLUMN `name` `name_pda` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'PDA字段名称' AFTER `id`;

ALTER TABLE dv_machinery add UNIQUE indx_watt_hour_meter (watt_hour_meter);
ALTER TABLE dv_machinery add UNIQUE indx_thermometer (thermometer);


ALTER TABLE dv_temperature_data add task_name varchar(255) COMMENT '任务名称';
ALTER TABLE dv_temperature_data add device_code varchar(255) COMMENT '设备号';
ALTER TABLE dv_temperature_data add device_name varchar(255) COMMENT '设备名称';
ALTER TABLE dv_temperature_data add process_name varchar(255) COMMENT '工序名称';

ALTER TABLE dv_warm_humid_data add task_name varchar(255) COMMENT '任务名称';
ALTER TABLE dv_warm_humid_data add device_code varchar(255) COMMENT '设备号';
ALTER TABLE dv_warm_humid_data add device_name varchar(255) COMMENT '设备名称';
ALTER TABLE dv_warm_humid_data add process_name varchar(255) COMMENT '工序名称';


ALTER TABLE dv_watt_hour_meter_data add task_name varchar(255) COMMENT '任务名称';
ALTER TABLE dv_watt_hour_meter_data add device_code varchar(255) COMMENT '设备号';
ALTER TABLE dv_watt_hour_meter_data add device_name varchar(255) COMMENT '设备名称';
ALTER TABLE dv_watt_hour_meter_data add process_name varchar(255) COMMENT '工序名称';


-- 2022-12-05
ALTER TABLE dv_temperature_data add batchNo varchar(255) COMMENT '批次';
ALTER TABLE dv_warm_humid_data add batchNo varchar(255) COMMENT '批次';
ALTER TABLE dv_watt_hour_meter_data add batchNo varchar(255) COMMENT '批次';

ALTER TABLE pro_task add machinery_id varchar(32)  COMMENT '是否完成';

ALTER TABLE dv_machinery add is_pda_equipment char COMMENT '是否pda设备';

ALTER TABLE wm_item_recpt_line add status  varchar(6) COMMENT '物料状态';

-- ----------------------------
DROP TABLE IF EXISTS `qc_item_template`;
CREATE TABLE `qc_item_template`  (
                                     `item_template_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                     `link_type` varchar(255) NOT NULL COMMENT '关联表',
                                     `link_id` bigint NOT NULL COMMENT '关联主机',
                                     `template_id` bigint NOT NULL COMMENT '检测模板ID',
                                     `item_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品ID',
                                     `item_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品编码',
                                     `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
                                     `specification` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品规格',
                                     `unit_of_measure` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品单位',
                                     `quantity_check` int NULL DEFAULT 1 COMMENT '最低检测数',
                                     `quantity_unqualified` int NULL DEFAULT 0 COMMENT '最大不合格数',
                                     `cr_rate` double(12, 2) NULL DEFAULT 0.00 COMMENT '最大致命缺陷率',
  `maj_rate` double(12, 2) NULL DEFAULT 0.00 COMMENT '最大严重缺陷率',
  `min_rate` double(12, 2) NULL DEFAULT 100.00 COMMENT '最大轻微缺陷率',
  `count_template` bigint NULL DEFAULT NULL COMMENT '检测总量',
  `count_unqualified` bigint NULL DEFAULT NULL COMMENT '不合格数量',
  `status` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`item_template_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 213 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '检测模板-产品检测汇总表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of qc_item_template
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;


-- ----------------------------
DROP TABLE IF EXISTS `qc_item_template_index`;
CREATE TABLE `qc_item_template_index`  (
                                           `item_template_index_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                           `item_template_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检测记录单id',
                                           `template_id` bigint NOT NULL COMMENT '检测模板ID',
                                           `index_id` bigint NOT NULL COMMENT '检测项ID',
                                           `item_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品ID',
                                           `item_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品编码',
                                           `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
                                           `specification` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品规格',
                                           `item_unit_of_measure` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品单位',
                                           `count_template` bigint NULL DEFAULT NULL COMMENT '检测总量',
                                           `count_unqualified` bigint NULL DEFAULT NULL COMMENT '不合格数量',
                                           `status` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态',
                                           `index_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '检测项编码',
                                           `index_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '检测项名称',
                                           `index_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '检测项类型',
                                           `check_method` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检测要求',
                                           `stander_val` double(12, 4) NULL DEFAULT NULL COMMENT '标准值',
  `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
  `threshold_max` double(12, 4) NULL DEFAULT NULL COMMENT '误差上限',
  `threshold_min` double(12, 4) NULL DEFAULT NULL COMMENT '误差下限',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`item_template_index_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 213 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '检测模板-产品检测项表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of qc_item_template_index
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;



ALTER TABLE `wm_material_stock` ADD COLUMN `item_type` varchar(255) NULL COMMENT '库存分类' AFTER `item_name`;
ALTER TABLE `wm_item_recpt_line` ADD COLUMN `quantity_out` double(12, 2) COMMENT '出库数量';
ALTER TABLE `pro_task` ADD COLUMN `is_get_materials` varchar(255) NULL COMMENT '是否领料' AFTER `item_name`;

ALTER TABLE `wm_rt_issue` ADD COLUMN `task_id` varchar(255) NULL COMMENT '任务id';
ALTER TABLE `wm_rt_issue` ADD COLUMN `task_code` varchar(255) NULL COMMENT '任务名称';

ALTER TABLE `wm_issue_line` ADD COLUMN `item_recpt_line_id` varchar(255) NULL COMMENT '物料入库记录';
ALTER TABLE `wm_issue_line` ADD COLUMN `let_step_material` varchar(255) NULL COMMENT '入库物料状态';

ALTER TABLE `wm_rt_issue_line` ADD COLUMN `item_recpt_line_id` varchar(255) NULL COMMENT '物料入库记录';
ALTER TABLE `wm_rt_issue_line` ADD COLUMN `let_step_material` varchar(255) NULL COMMENT '入库物料状态';

-- 2022-12-08
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('产品标签打印', '2072', '1', 'mdLabelPrint', 'mes/md/mdLabelPrint/index', 1, 0, 'C', '0', '0', 'md:mdLabelPrint:list', '#', 'admin', sysdate(), '', null, '产品标签打印菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('产品标签打印查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'md:mdLabelPrint:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('产品标签打印新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'md:mdLabelPrint:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('产品标签打印修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'md:mdLabelPrint:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('产品标签打印删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'md:mdLabelPrint:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('产品标签打印导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'md:mdLabelPrint:export',       '#', 'admin', sysdate(), '', null, '');

DROP TABLE IF EXISTS `md_label_print`;
CREATE TABLE `md_label_print`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id\r\n',
  `item_id` bigint NULL DEFAULT NULL COMMENT '产品物料id',
  `item_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料编码',
  `item_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料名称',
  `specification` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格型号',
  `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
  `batch_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生产批次号',
  `prefix` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '前缀',
  `sta_serial_number` int NULL DEFAULT NULL COMMENT '开始流水号',
  `end_serial_number` int NULL DEFAULT NULL COMMENT '结束流水号',
  `print_quantity` int NULL DEFAULT NULL COMMENT '打印数量',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品标签打印' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


-- 20221213

-- ----------------------------
CREATE TABLE `pro_item_need`  (
                                  `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
                                  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
                                  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
                                  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                  `client_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID',
                                  `client_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户编码',
                                  `client_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户名称',
                                  `client_nick` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户简称',
                                  `item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品ID',
                                  `item_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品编码',
                                  `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
                                  `specification` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品规格',
                                  `viscosity` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品粘度',
                                  `unit_of_measure` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品单位',
                                  `need_date` datetime NULL DEFAULT NULL COMMENT '需求时间',
                                  `need_count` int NULL DEFAULT NULL COMMENT '需求数量',
                                  `need_remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '需求备注',
                                  `stock_date` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                  `stock_user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备货人ID',
                                  `stock_user_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备货人',
                                  `stock_count` int NULL DEFAULT NULL COMMENT '备货数量',
                                  `stock_reamrk` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备货备注',
                                  `shipped_type` int NULL DEFAULT NULL COMMENT '是否已发货 0需求中 10确定预出库  20备货中  30已发货',
                                  `shipped_person` int NULL DEFAULT NULL COMMENT '发货人',
                                  `shipped_date` datetime NULL DEFAULT NULL COMMENT '发货人',
                                  `shipped_remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '发货备注',
                                  `shipped_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货人ID',
                                  `shipped_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货人',
                                  PRIMARY KEY (`record_id`) USING BTREE,
                                  INDEX `idx_item_id_shipped_type`(`item_id` ASC, `shipped_type` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 214 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客戶产品需求' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

ALTER TABLE wm_material_stock add viscosity varchar(255)  COMMENT '粘度';

CREATE TABLE `wm_material_statistics`  (
                                           `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                           `item_type_id` bigint NULL DEFAULT NULL COMMENT '物料类型ID',
                                           `item_id` bigint NOT NULL COMMENT '产品物料ID',
                                           `item_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料编码',
                                           `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料名称',
                                           `item_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '库存分类',
                                           `specification` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格型号',
                                           `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
                                           `viscosity` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '粘度',
                                           `quantity_onhand` decimal(12, 2) NULL DEFAULT NULL COMMENT '库存数量',
                                           `quantity_will_out` decimal(12, 2) NULL DEFAULT NULL COMMENT '预出库数量',
                                           `quantity_product` decimal(12, 2) NULL DEFAULT NULL COMMENT '生产数量',
                                           `quantity_need` decimal(12, 2) NULL DEFAULT NULL COMMENT '需求数量',
                                           `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
                                           `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                           `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
                                           `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                           `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                           PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存记录表' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


ALTER TABLE wm_material_stock add quantity_need decimal(12,2)  COMMENT '需求数量';

ALTER table pro_item_need ADD INDEX idx_item_id_shipped_type (item_id,shipped_type);

ALTER TABLE pro_item_need add shipped_user_id varchar(255)  COMMENT '发货人ID';
ALTER TABLE pro_item_need add shipped_user_name varchar(255)  COMMENT '发货人';

ALTER TABLE wm_material_stock add quantity_need decimal(12,2)  COMMENT '需求数量';
ALTER TABLE wm_material_stock add quantity_will_out decimal(12,2)  COMMENT '预出库数量';
ALTER TABLE wm_material_stock add quantity_product decimal(12,2)  COMMENT '生产数量';

ALTER TABLE pro_item_need add tag varchar(255)  COMMENT '是否有标签';
ALTER TABLE pro_item_need add packing_type varchar(255)  COMMENT '包装规格';
ALTER TABLE mes_scales_order_item add tag varchar(255)  COMMENT '是否有标签';
ALTER TABLE `mes_scales_order_item` MODIFY COLUMN `request_date` datetime NULL DEFAULT NULL COMMENT '需求日期' AFTER `quantity_pro`;

CREATE TABLE `wm_stock_up`  (
                                `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',

                                `item_need_record_id` bigint NULL DEFAULT NULL COMMENT '客户产品需求单ID',

                                `item_id` bigint NOT NULL COMMENT '产品物料ID',
                                `item_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料编码',
                                `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料名称',
                                `item_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '库存分类',
                                `specification` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格型号',
                                `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
                                `viscosity` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '粘度',
                                `packing_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '包装规格',
                                `tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否有标签',
                                `quantity_will_out` decimal(12, 2) NULL DEFAULT NULL COMMENT '备货数量',

                                `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '创建人' COMMENT '创建者',
                                `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '更新人' COMMENT '更新者',
                                `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户产品需求单备货记录' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

ALTER TABLE wm_stock_up add warehouse_id varchar(255)  COMMENT '仓库ID';
ALTER TABLE wm_stock_up add warehouse_code varchar(255)  COMMENT '仓库编码';
ALTER TABLE wm_stock_up add warehouse_name varchar(255)  COMMENT '仓库名称';

ALTER TABLE wm_material_stock add packing_type varchar(255)  COMMENT '包装规格';


CREATE TABLE `md_batch_header`  (
                                    `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                    `record_type`  bigint NOT NULL COMMENT '分类',

                                    `item_id` bigint NULL DEFAULT NULL COMMENT '产品物料id',
                                    `item_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料编码',
                                    `item_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品物料名称',
                                    `specification` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格型号',
                                    `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
                                    `viscosity` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '粘度',
                                    `tag` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签',
                                    `packing_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装箱规格',

                                    `batch_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生产批次号',
                                    `prefix` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '前缀',

                                    `start_number` int NULL DEFAULT NULL COMMENT '开始流水号',
                                    `end_number` int NULL DEFAULT NULL COMMENT '结束流水号',

                                    `quantity` int NOT NULL COMMENT '数量',

                                    `product_date` datetime NULL DEFAULT NULL COMMENT '生产日期',
                                    `valid_date` datetime NULL DEFAULT NULL COMMENT '有效期',

                                    `test_result` varchar(64) NULL DEFAULT NULL COMMENT '检测结果',


                                    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                    `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                    `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                    PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品批次单' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


DROP TABLE IF EXISTS `md_batch_content`;
CREATE TABLE `md_batch_content`  (
                                     `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                     `batch_header_id` bigint NOT NULL COMMENT '产品批次单ID',
                                     `item_id` bigint NULL DEFAULT NULL COMMENT '产品物料id',
                                     `serial_number` int NULL DEFAULT NULL COMMENT '流水号',
                                     `print_number` int NOT NULL COMMENT '打印数量',
                                     `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                     `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                     `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                     `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                     `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                     PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品批次单流水号明细' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


CREATE TABLE `wm_stock_out`  (
                                 `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                 `item_id` bigint NULL DEFAULT NULL COMMENT '产品物料id',
                                 `item_need_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户需求单id',
                                 `item_recpt_line_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '物料入库记录',
                                 `quantity` int NOT NULL COMMENT '数量',
                                 `status` int NOT NULL COMMENT '状态',
                                 `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                 `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                 `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                 `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                 `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                 PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品出库记录' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


CREATE TABLE `wm_stock_will_out`  (
                                      `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                      `link_type` varchar(64) NOT NULL  COMMENT '使用物料的表名',
                                      `link_id` varchar(64) NOT NULL COMMENT '使用物料的表ID',

                                      `stock_type` varchar(64) NOT NULL COMMENT '库存表',
                                      `stock_id` varchar(64) NOT NULL COMMENT '库存ID',
                                      `quantity` int NOT NULL COMMENT '预出库数量',

                                      `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                      `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                      `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                      `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                      `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                      PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品出库记录' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

ALTER TABLE `wm_item_recpt_line` ADD COLUMN `meterial_code` varchar(32) NULL COMMENT '物料码';
ALTER TABLE `wm_rt_issue_line` ADD COLUMN `meterial_code` varchar(32) NULL COMMENT '物料码';
ALTER TABLE `wm_issue_line` ADD COLUMN `meterial_code` varchar(32) NULL COMMENT '物料码';

ALTER TABLE pro_item_need add scales_order_item_id varchar(32)  COMMENT '关联销售订单';


DROP TABLE IF EXISTS `pda_menu`;
CREATE TABLE `pda_menu`  (
                             `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                             `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单名称',
                             `pad_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单编码',
                             `image_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片链接',
                             `sort` int NULL DEFAULT NULL COMMENT '排序',
                             `is_use` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '是否启用',
                             `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                             `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                             `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                             `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                             `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                             PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'PDA菜单' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


-- Table structure for pda_menu_person
-- ----------------------------
DROP TABLE IF EXISTS `pda_menu_person`;
CREATE TABLE `pda_menu_person`  (
                                    `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                    `pda_menu_id` bigint NOT NULL COMMENT '菜单名称',
                                    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                    `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                    `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                    PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'PDA菜单关联用户' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;


-- 2023-01-03更新后
ALTER TABLE `md_item_type` ADD COLUMN `mes_type` varchar(32) NULL COMMENT 'mes统计分类';


DROP TABLE IF EXISTS `wm_assemble_recpt_line`;
CREATE TABLE `wm_assemble_recpt_line`  (
                                           `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '行ID',

                                           `item_recpt_line_id` bigint NULL DEFAULT NULL COMMENT '入库单行ID',

                                           `from_item_recpt_line_id` bigint NULL DEFAULT NULL COMMENT '来源ID',
                                           `quantity_recived` double(12, 2) NOT NULL COMMENT '数量',

  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',

  PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物料组装入库' ROW_FORMAT = Dynamic;


-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料组装入库', '2042', '1', 'wmAssembleRecptLine', 'mes/wm/wmAssembleRecptLine/index', 1, 0, 'C', '0', '0', 'wm:wmAssembleRecptLine:list', '#', 'admin', sysdate(), '', null, '物料组装入库菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料组装入库查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'wm:wmAssembleRecptLine:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料组装入库新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'wm:wmAssembleRecptLine:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料组装入库修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'wm:wmAssembleRecptLine:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料组装入库删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'wm:wmAssembleRecptLine:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('物料组装入库导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'wm:wmAssembleRecptLine:export',       '#', 'admin', sysdate(), '', null, '');


ALTER TABLE `wm_item_recpt_line` ADD COLUMN `in_type` varchar(32) NULL COMMENT '入库类型';
ALTER TABLE `wm_assemble_recpt_line` ADD COLUMN `item_id` bigint NULL COMMENT '物料ID' AFTER `from_item_recpt_line_id`;

-- 2023-01-04更新后
ALTER TABLE `pda_menu` ADD unique(`pad_code`);

ALTER TABLE `wm_item_recpt_line` ADD COLUMN `is_in_stock` varchar(32) NULL COMMENT '是否执行入库:0未入库 1已入库';

ALTER TABLE `wm_assemble_recpt_line` ADD COLUMN `warehouse_id` bigint NULL COMMENT '入库仓库' AFTER `item_id`;
ALTER TABLE `wm_assemble_recpt_line` ADD COLUMN `meterial_code` bigint NULL COMMENT '物料码' AFTER `warehouse_id`;
ALTER TABLE `wm_assemble_recpt_line` ADD COLUMN `batch_code` bigint NULL COMMENT '批次号' AFTER `meterial_code`;

ALTER TABLE `wm_item_recpt_line` ADD COLUMN `from_item_recpt_id` bigint NULL COMMENT '来源的入库记录ID';

ALTER TABLE `wm_assemble_recpt_line` ADD COLUMN `quantity_out` double(12, 2)  default 0 COMMENT '使用数量';


-- ----------------------------
DROP TABLE IF EXISTS `wm_item_split_line`;
CREATE TABLE `wm_item_split_line`  (

  `line_id` bigint NOT NULL AUTO_INCREMENT COMMENT '行ID',
  `item_id` bigint NOT NULL COMMENT '产品物料ID',

  `warehouse_id` bigint NULL DEFAULT NULL COMMENT '仓库ID',
  `location_id` bigint NULL DEFAULT NULL COMMENT '库区ID',

  `quantity` double(12, 2) NULL DEFAULT NULL COMMENT '数量',
  `batch_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '入库批次号',
  `meterial_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '物料码',
  `is_in_stock` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否执行入库:0未入库 1已入库',
  `from_item_recpt_line_id` bigint NULL DEFAULT NULL COMMENT '来源的入库记录ID',

  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',

  PRIMARY KEY (`line_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物料拆分表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

ALTER TABLE `wm_item_split_line` ADD COLUMN `is_in_stock`varchar(32)  default '0' COMMENT '使用数量';

DROP TABLE IF EXISTS `wm_split_recpt_line`;
CREATE TABLE `wm_split_recpt_line`  (
                                        `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '行ID',
                                        `from_item_recpt_line_id` bigint NULL DEFAULT NULL COMMENT '组装物料ID',
                                        `from_assemble_recpt_line_id` bigint NULL DEFAULT NULL COMMENT '组装物料组成ID',
                                        `item_id` bigint NULL DEFAULT NULL COMMENT '物料ID',
                                        `warehouse_id` bigint NULL DEFAULT NULL COMMENT '入库仓库',
                                        `meterial_code` varchar(32) NULL DEFAULT NULL COMMENT '物料码',
                                        `batch_code` varchar(32) NULL DEFAULT NULL COMMENT '批次号',
                                        `quantity_recived` double(12, 2) NOT NULL COMMENT '数量',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `quantity_out` double(12, 2) NULL DEFAULT 0.00 COMMENT '使用数量',
  PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物料拆分成分记录' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

ALTER TABLE `wm_item_split_line` ADD COLUMN `item_split_line_id` bigint  default '0' COMMENT '拆分入库ID';

ALTER TABLE `wm_assemble_recpt_line` ADD COLUMN `expire_date` datetime NULL DEFAULT NULL COMMENT '有效期';


-- 2023-01-12
ALTER TABLE `pro_task` MODIFY COLUMN `process_product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品统计名称，作为同一个产品进行统计' AFTER `viscosity`;


-- 202-01-16
CREATE TABLE `qc_item_testing_result`  (
    `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',

    `item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品ID',
    `task_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '排产任务id',

    `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
    `specification` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '型号',
    `viscosity` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '粘度',
    `date_pruduct` datetime NULL DEFAULT NULL COMMENT '生产日期',
    `batch_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '批号',
    `barrel_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '桶号',
    `appearance` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外观',
    `weight` double(12, 1) NULL DEFAULT NULL COMMENT '重量',
    `weight_real` double(12, 1) NULL DEFAULT NULL COMMENT '实际重量',
    `dissolution_ratio` double(12, 3) NULL DEFAULT NULL COMMENT '溶剂比例',
    `viscosity_grinding` double(12, 0) NULL DEFAULT NULL COMMENT '研磨粘度（25℃）',
    `viscosity_before_packaging` double(12, 0) NULL DEFAULT NULL COMMENT '包装前粘度（25℃）',
    `solvent_replenishment` double(12, 0) NULL DEFAULT NULL COMMENT '补溶剂(Kg)',
    `viscosity_packaging` double(12, 0) NULL DEFAULT NULL COMMENT '包装粘度（25℃）',
    `date_packaging` datetime NULL DEFAULT NULL COMMENT '包装时间',
    `quality_judgment` varchar(64) NULL DEFAULT NULL COMMENT '品质判定',

    `test_temperature1` int NULL DEFAULT NULL COMMENT '测试温度1',
    `viscosity4_day_vt06` int NULL DEFAULT NULL COMMENT '4天VT06粘度',
    `viscosity_corrected1` int NULL DEFAULT NULL COMMENT '修正粘度1(25℃)',

    `test_temperature2` int NULL DEFAULT NULL COMMENT '测试温度2',
    `viscosity10_day_vt06` int NULL DEFAULT NULL COMMENT '10天VT06粘度',
    `viscosity_corrected2` int NULL DEFAULT NULL COMMENT '修正粘度2(25℃)',

    `grinding_fineness1` double(12, 0) NULL DEFAULT NULL COMMENT '研磨2 细度',
    `grinding_pitting1` double(12, 0) NULL DEFAULT NULL COMMENT '研磨2 麻点',

    `grinding_fineness2` double(12, 0) NULL DEFAULT NULL COMMENT '研磨3 细度',
    `grinding_pitting2` double(12, 0) NULL DEFAULT NULL COMMENT '研磨3 麻点',

    `packaging_fineness` double(12, 0) NULL DEFAULT NULL COMMENT '包装 细度',
    `packaging_pitting` double(12, 0) NULL DEFAULT NULL COMMENT '包装 麻点',

    `hardness` double(12, 0) NULL DEFAULT NULL COMMENT '硬度（H）',


    `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
    `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',

    PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品检测记录' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

-- 202-01-16
CREATE TABLE `qc_item_testing_result_sort`  (
                                                `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',

                                                `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码',
                                                `sort_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '排序名称',
                                                `sort_index` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '排序位置',

                                                `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
                                                `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
                                                `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                                `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
                                                `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',

                                                PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品检测记录排序' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

ALTER TABLE `qc_item_testing_result`
    MODIFY COLUMN `viscosity` int NULL DEFAULT NULL COMMENT '粘度' AFTER `specification`;

-- 2023-02-03
ALTER TABLE `pro_workorder`
    MODIFY COLUMN `quantity` double(14, 2) NOT NULL DEFAULT 0.00 COMMENT '生产数量(重量)',
    ADD COLUMN `tag_type` int NULL COMMENT '标签类型',
    ADD COLUMN `tag_date` datetime NULL COMMENT '标签日期',
    ADD COLUMN `batch_code` varchar(64) NULL COMMENT '批号',
    ADD COLUMN `barrelage` int NULL COMMENT '桶数',
    ADD COLUMN `bucket_code` varchar(64) NULL COMMENT '桶号';

-- 2023-02-04
ALTER TABLE dv_machinery add color varchar(30) COMMENT '颜色';


DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log`  (
                            `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                            `type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型',
                            `title` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
                            `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '位置',
                            `param` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '参数',
                            `reslut` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '结果',
                            `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
                            `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                            `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
                            `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                            PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '日志记录' ROW_FORMAT = DYNAMIC;


-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('日志记录', '2', '1', 'sysLog', 'mes/sys/sysLog/index', 1, 0, 'C', '0', '0', 'sys:sysLog:list', '#', 'admin', sysdate(), '', null, '日志记录菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('日志记录查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'sys:sysLog:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('日志记录新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'sys:sysLog:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('日志记录修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'sys:sysLog:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('日志记录删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'sys:sysLog:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('日志记录导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'sys:sysLog:export',       '#', 'admin', sysdate(), '', null, '');


-- 2023-2-13
ALTER TABLE `pro_workorder` ADD COLUMN `split_ids` text NULL COMMENT '拆分步骤' AFTER `bucket_code`;


ALTER TABLE `wm_warehouse` ADD COLUMN `pubufts` bigint NULL COMMENT '更新版本' AFTER `update_time`;
ALTER TABLE `wm_material_stock`  ADD COLUMN `tag` varchar(32) NULL COMMENT '标签' AFTER `packing_type`;
ALTER TABLE `wm_material_stock` MODIFY COLUMN `item_id` bigint NULL COMMENT '产品物料ID' AFTER `item_type_id`;
ALTER TABLE `wm_item_recpt_line`  ADD COLUMN `packing_type` varchar(32) NULL COMMENT '包装规格';
ALTER TABLE `wm_item_recpt_line` MODIFY COLUMN `item_id` bigint NULL COMMENT '产品物料ID' AFTER `recpt_id`;

ALTER TABLE `wm_warehouse` ADD COLUMN `pubufts` bigint NULL COMMENT '更新版本' AFTER `update_time`;
ALTER TABLE `wm_warehouse` ADD COLUMN `pubufts` bigint NULL COMMENT '更新版本' AFTER `update_time`;


-- 2023-02-14更新后
DROP TABLE IF EXISTS `md_statistics_bom`;
CREATE TABLE `md_statistics_bom`  (
                                      `bom_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '流水号',
                                      `item_id` bigint(0) NOT NULL COMMENT '统计分类ID',
                                      `bom_item_id` bigint(0) NOT NULL COMMENT 'BOM物料ID',
                                      `bom_item_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'BOM物料编码',
                                      `bom_item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'BOM物料名称',
                                      `bom_item_spec` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'BOM物料规格',
                                      `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'BOM物料单位',
                                      `item_or_product` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品物料标识',
                                      `quantity` double(12, 4) NOT NULL DEFAULT 0.0000 COMMENT '物料使用比例',
                                      `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Y' COMMENT '是否启用',
                                      `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
                                      `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1',
                                      `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2',
                                      `attr3` int(0) NULL DEFAULT 0 COMMENT '预留字段3',
                                      `attr4` int(0) NULL DEFAULT 0 COMMENT '预留字段4',
                                      `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
                                      `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
                                      `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
                                      `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
                                      `pubufts` bigint(0) NOT NULL DEFAULT 0 COMMENT 'T6 ERP数据变更标识',
                                      `auto_id` bigint(0) NOT NULL DEFAULT 0 COMMENT 'T6 子表标识',
                                      PRIMARY KEY (`bom_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 0 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '统计分类BOM关系表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `md_statistics_type`;
CREATE TABLE `md_statistics_type`  (
                                       `statistics_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '统计分类ID',
                                       `statistics_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '统计分类名称',
                                       `order_num` int(0) NULL DEFAULT 1 COMMENT '排列顺序',
                                       `enable_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Y' COMMENT '是否启用',
                                       `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
                                       `attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1',
                                       `attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2',
                                       `attr3` int(0) NULL DEFAULT 0 COMMENT '预留字段3',
                                       `attr4` int(0) NULL DEFAULT 0 COMMENT '预留字段4',
                                       `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
                                       `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
                                       `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
                                       `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
                                       PRIMARY KEY (`statistics_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '统计分类表' ROW_FORMAT = Dynamic;

ALTER TABLE md_item ADD  process_product_id int COMMENT '根据工序流程区分的产品ID';

CREATE TABLE [dbo].[mes_stock](
    [ID] [nvarchar](32) NULL, -- 记录IDA
    [create_time] [datetime] NULL,
    [itemCode] [nvarchar](32) NULL,
    [quantity] [decimal](12, 2) NULL,
    [batchCode] [nchar](12) NULL,
    [warehoseCode] [nchar](10) NULL,
    [expireDate] [datetime] NULL,
    [type2] [nchar](20) NULL,
    [splitItemCode] [nchar](10) NULL,
    [splitQuantity] [decimal](12, 2) NULL,
    [splitBatchCode] [nchar](10) NULL,
    [splitWarehoseCode] [nchar](10) NULL,
    [splitExpireDate] [datetime] NULL
    ) ON [PRIMARY]


-- 2023-02-15更新后
alter table wm_warehouse modify warehouse_id int auto_increment;


ALTER TABLE wm_item_recpt_line ADD  quantity double(12, 2) COMMENT '剩余库存';
-- 统计入库剩余量
UPDATE wm_item_recpt_line set quantity=quantity_recived - quantity_out WHERE quantity is null or quantity = 0;


-- 2023-02-17
ALTER TABLE `pro_workorder` MODIFY COLUMN `split_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '拆分步骤(工序id)' AFTER `bucket_code`;
ALTER TABLE `pro_workorder` ADD COLUMN `parent_workorder_id` bigint NULL COMMENT '拆分父工单id' AFTER `split_ids`;
ALTER TABLE `pro_workorder` ADD COLUMN `proroute_id` bigint NULL COMMENT '拆分后工艺流程id' AFTER `parent_workorder_id`;

-- 2023-02-18
ALTER TABLE `pro_route_product` MODIFY COLUMN `item_id` bigint NULL COMMENT '产品物料ID' AFTER `route_id`;
ALTER TABLE `pro_route_product` MODIFY COLUMN `item_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '产品物料编码' AFTER `item_id`;
ALTER TABLE `pro_route_product` MODIFY COLUMN `item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '产品物料名称' AFTER `item_code`;
ALTER TABLE `pro_route_product` MODIFY COLUMN `unit_of_measure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '单位' AFTER `specification`;
ALTER TABLE `pro_route_product` MODIFY COLUMN `process_product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '根据工序流程区分的产品名称' AFTER `update_time`;
ALTER TABLE `pro_route_product` ADD COLUMN `statistics_id` bigint NOT NULL COMMENT '统计分类id' AFTER `process_product_name`;

-- 2023-02-21
ALTER TABLE `md_statistics_type` ADD COLUMN `statistics_quantity` int NULL COMMENT '统计分类重量(kg)' AFTER `enable_flag`;
ALTER TABLE `md_statistics_type` ADD COLUMN `appearance` varchar(255) NULL COMMENT '外观' AFTER `statistics_quantity`;

-- 2023-02-22 统计分类的统计分类BOM表
DROP TABLE IF EXISTS `md_statistics_type_bom`;
CREATE TABLE `md_statistics_type_bom`  (
                                           `bom_id` bigint NOT NULL AUTO_INCREMENT COMMENT '统计分类的统计BOM ID',
                                           `statistics_id` bigint NOT NULL COMMENT '统计分类ID',
                                           `statistics_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '统计分类名称',
                                           `order_num` int NULL DEFAULT 1 COMMENT '排列顺序',
                                           `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
                                           `quantity`  double(12, 4) DEFAULT '0' COMMENT '使用比例',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`bom_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '统计分类的统计分类BOM表' ROW_FORMAT = DYNAMIC;

ALTER TABLE `md_statistics_type_bom` ADD COLUMN `parent_id` bigint NOT NULL COMMENT '主表id' AFTER `update_time`;

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('统计分类的统计分类BOM', '3514', '1', 'mdStatisticsTypeBom', 'mes/md/mdStatisticsTypeBom/index', 1, 0, 'C', '0', '0', 'md:mdStatisticsTypeBom:list', '#', 'admin', sysdate(), '', null, '统计分类的统计分类BOM菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('统计分类的统计分类BOM查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'md:mdStatisticsTypeBom:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('统计分类的统计分类BOM新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'md:mdStatisticsTypeBom:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('统计分类的统计分类BOM修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'md:mdStatisticsTypeBom:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('统计分类的统计分类BOM删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'md:mdStatisticsTypeBom:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('统计分类的统计分类BOM导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'md:mdStatisticsTypeBom:export',       '#', 'admin', sysdate(), '', null, '');


-- 产品的统计分类BOM
CREATE TABLE `md_product_statistics_bom`  (
                                              `bom_id` bigint NOT NULL AUTO_INCREMENT COMMENT '产品的统计BOM ID',
                                              `item_id` bigint NOT NULL COMMENT '产品ID',
                                              `statistics_id` bigint NOT NULL COMMENT '统计分类ID',
                                              `statistics_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '统计分类名称',
                                              `order_num` int NULL DEFAULT 1 COMMENT '排列顺序',
                                              `quantity` double(12, 4) NULL DEFAULT 0.0000 COMMENT '使用比例',

  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`bom_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '产品的统计分类BOM表' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `md_product_statistics_bom` ADD COLUMN `bom_parent_id` bigint NOT NULL DEFAULT '0' COMMENT 'BOM的主表ID' AFTER `update_time`;


-- 2023-02-23
ALTER TABLE `wm_item_recpt` ADD COLUMN  `batch_code` varchar(32) NULL DEFAULT NULL COMMENT '批次号';;
ALTER TABLE `pda_menu` MODIFY COLUMN `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '备注' AFTER `is_use`;

--- 工艺流程添加设备
ALTER TABLE `pro_route_product` DROP INDEX `idx_process_product_name`;
ALTER TABLE `pro_route` ADD COLUMN `mechinery_name` varchar(255) NULL COMMENT '设备名称' AFTER `remark`;
ALTER TABLE `pro_route` ADD COLUMN `mechinery_id` bigint NULL COMMENT '设备id' AFTER `mechinery_name`;

-- 2023-02-22
ALTER TABLE md_item ADD COLUMN appearance VARCHAR(32) DEFAULT NULL COMMENT '外观';

--2023-02-24
ALTER TABLE `pda_menu`  DROP INDEX `pad_code`;

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('PDA采集标签说明', '2000', '1', 'pdaLabelType', 'mes/pad/pdaLabelType/index', 1, 0, 'C', '0', '0', 'pad:pdaLabelType:list', '#', 'admin', sysdate(), '', null, 'PDA采集标签说明菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('PDA采集标签说明查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'pad:pdaLabelType:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('PDA采集标签说明新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'pad:pdaLabelType:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('PDA采集标签说明修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'pad:pdaLabelType:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('PDA采集标签说明删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'pad:pdaLabelType:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('PDA采集标签说明导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'pad:pdaLabelType:export',       '#', 'admin', sysdate(), '', null, '');

ALTER TABLE `pro_task` ADD COLUMN `task_status` varchar(32) NULL COMMENT '排产状态' AFTER `machinery_id`;
ALTER TABLE `pro_task` ADD UNIQUE INDEX `unidx_workorder_id_taskstatus`(`workorder_id`, `task_status`) COMMENT '判断唯一';


-- 2023-03-01
ALTER TABLE `md_statistics_type` ADD COLUMN `statistics_type_bom_string` varchar(255) NULL COMMENT '统计分类BOM字符';
UPDATE md_statistics_type,(SELECT parent_id,group_concat(CONCAT(statistics_name,'=',quantity) SEPARATOR ';') as gname FROM md_statistics_type_bom GROUP BY parent_id)P set statistics_type_bom_string=P.gname WHERE P.parent_id= md_statistics_type.statistics_id;

-- 2023-03-02
ALTER TABLE `pro_workorder` ADD COLUMN `parent_task_id` bigint NULL COMMENT '拆分父排产id';
ALTER TABLE `pro_workorder` ADD COLUMN `parent_route_id_ids` VARCHAR(255) NULL COMMENT '拆分前工艺流程';
ALTER TABLE `pro_workorder` ADD COLUMN `parent_route_indexs` VARCHAR(255) NULL COMMENT '拆分前工艺流程序号';

ALTER table pro_workorder ADD INDEX idx_batch_code (batch_code);
ALTER table pro_task ADD INDEX idx_workorder_id (workorder_id);
ALTER table pro_task ADD INDEX idx_production_date (production_date);

-- 2023-03-03
ALTER TABLE `pda_label_type` ADD COLUMN `split_str` varchar(2) NOT NULL COMMENT '分割符' AFTER `first_code`;

CREATE TABLE `pda_label_type_bom`  (
                                       `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                       `label_type_id` bigint NOT NULL  COMMENT '标签项',
                                       `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标签项',
                                       `index_num` varbinary(255) NULL DEFAULT NULL COMMENT '排序',
                                       `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                       `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                       `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                       `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                       `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                       PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'PDA采集标签内容' ROW_FORMAT = DYNAMIC;


CREATE TABLE `pda_label_type_item`  (
                                        `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                                        `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标签项',
                                        `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
                                        `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                        `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                        `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
                                        `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                        PRIMARY KEY (`record_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'PDA采集标签项' ROW_FORMAT = DYNAMIC;


-- 2023-03-07
ALTER TABLE `md_item` MODIFY COLUMN `pubufts` int NOT NULL DEFAULT '0' COMMENT 'ERP数据变更标识' AFTER `update_time`;

UPDATE pro_item_need LEFT JOIN md_item ON pro_item_need.item_code = md_item.item_code set pro_item_need.item_id = md_item.item_id;

UPDATE wm_material_stock LEFT JOIN md_item ON wm_material_stock.item_code = md_item.item_code set wm_material_stock.item_id = md_item.item_id;

UPDATE pro_workorder LEFT JOIN md_item ON pro_workorder.product_code = md_item.item_code set pro_workorder.product_id = md_item.item_id;

UPDATE wm_item_recpt_line LEFT JOIN md_item ON wm_item_recpt_line.item_code = md_item.item_code set wm_item_recpt_line.item_id = md_item.item_id;

UPDATE mes_scales_order_item LEFT JOIN md_item ON mes_scales_order_item.product_code = md_item.item_code set mes_scales_order_item.product_id = md_item.item_id;


-- 2023-03-07
ALTER TABLE `md_statistics_type` ADD COLUMN `parent_type_id` bigint NULL COMMENT '父id';
ALTER TABLE `md_statistics_type` ADD COLUMN `ancestors` VARCHAR(255) NULL COMMENT '父级列表';

-- 2023-03-08
UPDATE pro_task SET task_status = '已排产' WHERE task_status = '待排产'

ALTER TABLE `md_statistics_type` ADD COLUMN `itype` varchar(6) NULL COMMENT '类型';


-- 2023-03-11
UPDATE md_item SET pubufts = '0' WHERE pubufts = '';
ALTER TABLE "public"."md_item"
ALTER COLUMN "pubufts" TYPE int8 USING "pubufts"::int8,
  ALTER COLUMN "pubufts" DROP NOT NULL;

-- 2023-03-13 mysql
ALTER TABLE `pro_task`
    MODIFY COLUMN `batch_no` varchar(16) NULL DEFAULT NULL COMMENT '生产批次' AFTER `duration`;

-- 2023-03-13 pgsql
UPDATE  pro_task set batch_no = 0 WHERE batch_no ISNULL;
ALTER TABLE "public"."pro_task"
ALTER COLUMN "batch_no" TYPE varchar(16) USING "batch_no"::varchar(16),
  ALTER COLUMN "batch_no" SET NOT NULL;

ALTER TABLE "public"."pro_task"
DROP CONSTRAINT "pro_task_pkey",
  ALTER COLUMN "client_id" DROP NOT NULL,
  ALTER COLUMN "client_code" DROP NOT NULL,
  ADD CONSTRAINT "pro_task_pkey" PRIMARY KEY ("task_id", "item_name", "client_name");

ALTER TABLE "public"."pro_task"
    ALTER COLUMN "client_name" DROP NOT NULL;

ALTER TABLE "public"."pro_task"
DROP CONSTRAINT "pro_task_pkey",
  ALTER COLUMN "client_name" DROP NOT NULL,
  ADD CONSTRAINT "pro_task_pkey" PRIMARY KEY ("task_id", "item_name");

-- 创建函数
create or replace function ifReturn( avar VARCHAR,bvar VARCHAR,aint INT,bint INT) returns INT as $$
DECLARE
x int default 0;
begin
	IF avar = bvar then
		x := aint;
ELSE
		x := bint;
end if;
--
RETURN x;
end;
$$ language plpgsql;

create or replace function ifReturn( avar VARCHAR,aint INT,bint INT) returns INT as $$
DECLARE
x int default 0;
begin
	IF avar is NULL or avar = '' then
		x := bint;
ELSE
		x := aint;
end if;
--
RETURN x;
end;
$$ language plpgsql;

ALTER TABLE "public"."sys_user"
ALTER COLUMN "user_name" TYPE varchar(40) COLLATE "pg_catalog"."default";


ALTER TABLE "public"."wm_warehouse"
    ADD COLUMN "stock_color" varchar(32),
  ADD COLUMN "sort" int4;

COMMENT ON COLUMN "public"."wm_warehouse"."stock_color" IS '库存颜色';

COMMENT ON COLUMN "public"."wm_warehouse"."sort" IS '排序';

COMMENT ON COLUMN "public"."wm_stock_out"."status" IS '状态 1备货 2发货';


ALTER TABLE "public"."wm_item_recpt_line"
    ADD COLUMN "task_id" int4;

COMMENT ON COLUMN "public"."wm_item_recpt_line"."task_id" IS '任务ID';


ALTER TABLE "public"."wm_item_recpt_line"
    ADD COLUMN "workorder_id" int4;

COMMENT ON COLUMN "public"."wm_item_recpt_line"."workorder_id" IS '工单ID';

-- 20230317 统计MES 分类 ancestors
CREATE TABLE md_statistics_type_ph
AS
    (
        SELECT
            replace(
                    concat(
                            COALESCE(g.parent_type_id, 0),','
                        ,COALESCE(f.parent_type_id, 0),','
                        ,COALESCE(e.parent_type_id, 0),','
                        ,COALESCE(d.parent_type_id, 0),','
                        ,COALESCE(c.parent_type_id, 0),','
                        ,COALESCE(b.parent_type_id, 0),','
                        ,COALESCE(a.parent_type_id, 0),',')
                , '0,', '') as aaa
             ,a.statistics_id
        FROM
            md_statistics_type a
                LEFT JOIN md_statistics_type b on b.statistics_id = a.parent_type_id
                LEFT JOIN md_statistics_type c on c.statistics_id = b.parent_type_id
                LEFT JOIN md_statistics_type d on d.statistics_id = c.parent_type_id
                LEFT JOIN md_statistics_type e on e.statistics_id = d.parent_type_id
                LEFT JOIN md_statistics_type f on f.statistics_id = e.parent_type_id
                LEFT JOIN md_statistics_type g on g.statistics_id = f.parent_type_id
        WHERE a.parent_type_id is not NULL
    );


UPDATE md_statistics_type SET ancestors = T.aaa
    FROM (SELECT * FROM md_statistics_type_ph)T
WHERE md_statistics_type.statistics_id = T.statistics_id;


UPDATE md_item set process_product_id =  T.statistics_id
    from (SELECT md_statistics_type.statistics_id,md_statistics_type.statistics_name FROM md_statistics_type )T
WHERE T.statistics_name = md_item.process_product_name

ALTER TABLE "public"."pro_workorder" ALTER COLUMN "parent_id" DROP NOT NULL;


-- 2023-03-18
ALTER TABLE "public"."wm_assemble_recpt_line"
DROP COLUMN "need_item_id",
  ADD COLUMN "need_item_id" int4;

COMMENT ON COLUMN "public"."wm_assemble_recpt_line"."need_item_id" IS '客戶产品需求ID';


-- 2023-03-20

ALTER TABLE "public"."wm_item_recpt_line"
    ADD COLUMN "item_need_id" int4;

COMMENT ON COLUMN "public"."wm_item_recpt_line"."item_need_id" IS '产品需求ID';


UPDATE wm_item_recpt_line set is_in_stock = 1 WHERE is_in_stock is NULL;


-- 2023-03-21
ALTER TABLE "public"."pro_task" RENAME COLUMN "quantity_produced" TO "quantity_in";
COMMENT ON COLUMN "public"."pro_task"."quantity_in" IS '已入库';


CREATE OR REPLACE FUNCTION if(boolean, anyelement, anyelement)
   RETURNS anyelement AS $$
BEGIN
CASE WHEN ($1) THEN
    RETURN ($2);
ELSE
    RETURN ($3);
END CASE;
EXCEPTION WHEN division_by_zero THEN
    RETURN ($3);
END;
$$ LANGUAGE plpgsql;


ALTER TABLE "public"."pro_task" RENAME COLUMN "quantity_in" TO "quantity_not_in";

CREATE INDEX "wm_item_recpt_line_idx_batch_code" ON "public"."wm_item_recpt_line" ( "batch_code" );
CREATE INDEX "wm_item_recpt_line_idx_task_id" ON "public"."wm_item_recpt_line" ( "task_id" );


-- 2023-03-22
ALTER TABLE "public"."wm_item_recpt_line"
ALTER COLUMN "let_step_material" TYPE varchar(32) USING "let_step_material"::varchar(32);


-- 2023-03-28
ALTER TABLE "public"."wm_warehouse"
DROP COLUMN "confidentiality",
  ADD COLUMN "confidentiality" varchar(2);
COMMENT ON COLUMN "public"."wm_warehouse"."confidentiality" IS '是否保密';


ALTER TABLE "public"."dv_watt_hour_meter_data"
ALTER COLUMN "device_id" TYPE int8 USING "device_id"::int8;

ALTER TABLE "public"."dv_warm_humid_data"
ALTER COLUMN "device_id" TYPE int8 USING "device_id"::int8;

ALTER TABLE "public"."pro_task_device_process"
ALTER COLUMN "device_id" TYPE int8 USING "device_id"::int8;


ALTER TABLE "public"."dv_watt_hour_meter_data"
ALTER COLUMN "process_id" TYPE int8 USING "process_id"::int8;

ALTER TABLE "public"."dv_warm_humid_data"
ALTER COLUMN "process_id" TYPE int8 USING "process_id"::int8;

ALTER TABLE "public"."dv_temperature_data"
ALTER COLUMN "device_id" TYPE int8 USING "device_id"::int8,
  ALTER COLUMN "process_id" TYPE int8 USING "process_id"::int8;





-- 2023-03-29
ALTER TABLE "public"."wm_stock_will_out"
ALTER COLUMN "quantity" TYPE float8 USING "quantity"::float8;

-- 2023-03-30
ALTER TABLE "public"."wm_issue_header"
    ADD COLUMN "out_type" varchar(12);
COMMENT ON COLUMN "public"."wm_issue_header"."out_type" IS '出库类型';

ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "packing_type" varchar(32),
  ADD COLUMN "tag" varchar(32);
COMMENT ON COLUMN "public"."wm_issue_line"."packing_type" IS '包装规格';
COMMENT ON COLUMN "public"."wm_issue_line"."tag" IS '标签';


ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "out_type" varchar(12);
COMMENT ON COLUMN "public"."wm_issue_line"."out_type" IS '出库类型';

ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "item_need_id" int8;
COMMENT ON COLUMN "public"."wm_issue_line"."item_need_id" IS '客户需求单id';


ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "assemble_id_to_item_recpt_line_id" int8;
COMMENT ON COLUMN "public"."wm_issue_line"."assemble_id_to_item_recpt_line_id" IS '组装ID,也是入库记录ID';


ALTER TABLE "public"."wm_issue_header"
    ADD COLUMN "out_type" varchar(12);
COMMENT ON COLUMN "public"."wm_issue_header"."out_type" IS '出库类型';


ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "viscosity" varchar(8);

COMMENT ON COLUMN "public"."wm_issue_line"."viscosity" IS '粘度';


ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "expire_date" timestamp;

COMMENT ON COLUMN "public"."wm_issue_line"."expire_date" IS '有效期';



ALTER TABLE "public"."wm_stock_will_out"
ALTER COLUMN "quantity" TYPE float8 USING "quantity"::float8;


COMMENT ON COLUMN "public"."md_item"."process_product_name" IS '本来作为工艺分类，后面陆续修改，作为产品统计名称，按同一个产品进行统计';
COMMENT ON COLUMN "public"."md_item"."process_product_id" IS '本来作为工艺分类，后面陆续修改，作为产品统计ID，按同一个产品进行统计';

ALTER TABLE "public"."wm_stock_will_out"
ALTER COLUMN "quantity" TYPE decimal(16,2) USING "quantity"::decimal(16,2);


ALTER TABLE "public"."wm_issue_line"
    ADD COLUMN "is_in_stock" int4;
COMMENT ON COLUMN "public"."wm_issue_line"."is_in_stock" IS '0预出 1已出';

ALTER TABLE "public"."wm_issue_line"
ALTER COLUMN "is_in_stock" TYPE varchar(8) COLLATE "pg_catalog"."default";

UPDATE wm_issue_line set is_in_stock = '1' WHERE is_in_stock is null


ALTER TABLE "public"."wm_item_recpt_line"
    ALTER COLUMN "quantity" SET NOT NULL;


ALTER TABLE "public"."wm_item_recpt_line"
    ADD COLUMN "split_id_to_issue_line_id" int8;

COMMENT ON COLUMN "public"."wm_item_recpt_line"."split_id_to_issue_line_id" IS '拆分记录id';


-- 2023-05-10
ALTER TABLE "public"."dv_machinery"
    ADD COLUMN "warning_temp" decimal(10,2),
  ADD COLUMN "warning_duration" decimal(10,2);

COMMENT ON COLUMN "public"."dv_machinery"."warning_temp" IS '超过温度就警告';
COMMENT ON COLUMN "public"."dv_machinery"."warning_duration" IS '持续多长时间就警告';

-- 2023-05-15
ALTER TABLE "public"."dv_machinery"
    ADD COLUMN "warning_device_code" varchar(255),
  ADD COLUMN "warning_device_value" varchar(255);

COMMENT ON COLUMN "public"."dv_machinery"."warning_device_code" IS '当发送警告时，警告的设备';

COMMENT ON COLUMN "public"."dv_machinery"."warning_device_value" IS '当发送警告时，传递给设备的值';



ALTER TABLE "public"."wm_item_recpt_line"
    ADD COLUMN "materials_in_date" timestamp;

COMMENT ON COLUMN "public"."wm_item_recpt_line"."materials_in_date" IS '原材料入库时间';





--2023-07-20--
create table public.tp_item
(
    item_id              bigserial,
    item_code            varchar(64),
    item_name            varchar(255),
    specification        varchar(500),
    unit_of_measure      varchar(64),
    item_or_product      varchar(20),
    item_type_id         bigint,
    item_type_code       varchar(64),
    item_type_name       varchar(255),
    enable_flag          char,
    safe_stock_flag      char,
    min_stock            double precision,
    max_stock            double precision,
    remark               varchar(500),
    attr1                varchar(64),
    attr2                varchar(255),
    attr3                integer,
    attr4                integer,
    create_by            varchar(64),
    create_time          timestamp,
    update_by            varchar(64),
    update_time          timestamp,
    currency_name        varchar(255),
    inv_add_code         varchar(255),
    viscosity            varchar(35),
    tag                  varchar(35),
    packing_type         varchar(255),
    tax_rate             varchar(255),
    inv_box_std          varchar(255),
    inv_images           varchar(255),
    safety_file          varchar(255),
    third_report         varchar(255),
    measure_no           varchar(64),
    mes_type             varchar(255),
    mes_type_name        varchar(1000),
    valid_term           integer,
    net_weight           varchar(50),
    identification       varchar(50),
    ink_type             varchar(50),
    standard             varchar(50),
    process_product_name varchar(255),
    process_product_id   integer,
    appearance           varchar(32)
);

comment on table public.tp_item is 'T+物料表';

alter table public.tp_item
    owner to postgres;



create sequence auto_id increment by 1 minvalue 1 no maxvalue start with 1;
CREATE TABLE "tp_item_type" (
                                "id" bigint NOT NULL default nextval('auto_id'::regclass),
                                "item_type_code" varchar(64) NOT NULL,
                                "item_type_name" varchar(255) NOT NULL,
                                "parent_type_code" varchar(64) NOT NULL,
                                "parent_type_id" bigint NOT NULL DEFAULT '0',
                                "parent_type_code" varchar(64) NOT NULL DEFAULT '',
                                "ancestors" varchar(255)  NOT NULL DEFAULT '',
                                "item_or_product" varchar(20) default  '',
                                "order_num" int DEFAULT '1',
                                "enable_flag" char(1) NOT NULL DEFAULT 'Y',
                                "remark" varchar(500) DEFAULT '',
                                "attr1" varchar(64) DEFAULT NULL,
                                "attr2" varchar(255) DEFAULT NULL,
                                "attr3" varchar(64) DEFAULT '0',
                                "attr4" varchar(64) DEFAULT '0',
                                "mes_type" varchar(64),
                                "create_by" varchar(64) DEFAULT '',
                                "create_time" timestamp DEFAULT NULL,
                                "update_by" varchar(64) DEFAULT '',
                                "update_time" timestamp DEFAULT NULL,
                                PRIMARY KEY ("id")
);

COMMENT ON TABLE tp_item_type is '物料产品分类表';
comment on column tp_item_type.id is '产品物料类型ID';
comment on column tp_item_type.item_type_code is '产品物料类型编码';
comment on column tp_item_type.item_type_name is '产品物料类型名称';
comment on column tp_item_type.parent_type_id is '父类型ID';
comment on column tp_item_type.ancestors is '所有层级父节点';
comment on column tp_item_type.item_or_product is '产品物料标识';
comment on column tp_item_type.order_num is '排列顺序';
comment on column tp_item_type.enable_flag is '是否启用';
comment on column tp_item_type.remark is '备注';
----------------------------------------------------------

--增加更新T+存货分类定时任务
----------------------------------------------------------
INSERT INTO public.sys_job (job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, update_by, update_time, remark) VALUES (7, 'T+存货分类同步', 'DEFAULT', 'inventoryClassSyncDataTask.execute', '0 0 */1 * * ?', '1', '1', '1', 'admin', '2023-07-14 16:40:38.000000', 'admin', '2023-07-14 16:40:38.000000', '');



--增加更新T+存货定时任务
----------------------------------------------------------

INSERT INTO public.sys_job (job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, update_by, update_time, remark) VALUES (8, 'T+存货同步', 'DEFAULT', 'materielSyncDataTask.execute', '0 0 */1 * * ?', '1', '1', '1', 'admin', '2023-07-14 16:40:38.000000', 'admin', '2023-07-14 16:40:38.000000', '');

-------更新销售订单字段--------------------
alter table mes_scales_order
    add data_source VARCHAR;

comment on column mes_scales_order.data_source is '数据来源(TPLUS/MES)';


-------更新客户需求字段----------
alter table pro_item_need
    add data_source VARCHAR(20) DEFAULT '';

comment on column pro_item_need.data_source is '需求来源(/TPLUS)';






